﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Facade
{
    class Program
    {
        static void Main(string[] args)
        {
            Facade f = new Facade();
            f.MethodA();
            f.MethodB();

            Console.Read();
        }
    }

    class SubSystemOne
    {
        public void MethodOne()
        {
            MethodInfo mInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            Console.WriteLine("{0}'s {1}"
                , mInfo.DeclaringType.ToString(), mInfo.Name);
        }
    }

    class SubSystemTwo
    {
        public void MethodTwo()
        {
            MethodInfo mInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            Console.WriteLine("{0}'s {1}"
                , this.GetType().Name, mInfo.Name, mInfo.DeclaringType.ToString());
        }
    }

    class SubSystemThree
    {
        public void MethodThree()
        {
            MethodInfo mInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            Console.WriteLine("{0}'s {1}"
                , this.GetType().Name, mInfo.Name, mInfo.DeclaringType.ToString());
        }
    }

    class SubSystemFour
    {
        public void MethodFour()
        {
            MethodInfo mInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            Console.WriteLine("{0}'s {1}"
                , this.GetType().Name, mInfo.Name, mInfo.DeclaringType.ToString());
        }
    }

    class Facade
    {
        private SubSystemOne _one;

        private SubSystemTwo _two;

        private SubSystemThree _three;

        private SubSystemFour _four;



        public Facade()
        {

            _one = new SubSystemOne();

            _two = new SubSystemTwo();

            _three = new SubSystemThree();

            _four = new SubSystemFour();

        }



        public void MethodA()
        {

            Console.WriteLine("\nMethodA() ---- ");

            _one.MethodOne();

            _two.MethodTwo();

            _four.MethodFour();

        }



        public void MethodB()
        {

            Console.WriteLine("\nMethodB() ---- ");

            _two.MethodTwo();

            _three.MethodThree();

        }
    }
}
